﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Iterator
{
    class AnimalIterator : Iterator
    {
        List<string> list;
        int index = 0;
        public AnimalIterator(List<string> list)
        {
            this.list = list;
        }
        public object Next()
        {
            if (HasNext())
            {
                return this.list[index++];
            }
            else
            {
                return null;
            }
        }
        public bool HasNext()
        {
            if (this.list.Count > index)
            {
                return true;
            }
            return false;

        }
    }
}
